<?php namespace Siyuanliu\Filmcms\Updates;

use Schema;
use October\Rain\Database\Schema\Blueprint;
use October\Rain\Database\Updates\Migration;

class CreateResourcesTable extends Migration
{
    public function up()
    {
        Schema::create('siyuanliu_filmcms_resources', function(Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->increments('id');
            $table->integer('film_id')->unsigned()->nullable()->index();
            $table->string('title',255);
            $table->string('multSource',255);
            $table->string('playType',255);
            $table->timestamps();
        });
        // Schema::create('siyuanliu_filmcms_films_resources', function($table)
        // {
        //     $table->engine = 'InnoDB';
        //     $table->integer('film_id')->unsigned();
        //     $table->integer('resource_id')->unsigned();
        //     $table->primary(['film_id', 'resource_id']);
        // });
    }

    public function down()
    {
        Schema::dropIfExists('siyuanliu_filmcms_resources');
        // Schema::dropIfExists('siyuanliu_filmcms_films_resources');

    }
}
